package cc.vv.btpartyjob.partymanager.adapter

import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.baselibrary.view.LKCircleImageView
import cc.vv.baselibrary.view.OvalImageView
import cc.vv.btpartyjob.jnimodule.server.OperationServer
import cc.vv.btpartyjob.partymanager.R
import cc.vv.btpartyjob.partymanager.moudel.bean.PartyReportBean
import cc.vv.lkimagecomponent2.LKImage
import cc.vv.lkimagecomponent2.lib.mode.ScaleMode

/**
 * 党员报到 adapter
 * Created by Chen.qi on 2018/10/24.
 */
class PartyRegisterAdapter(layoutResId: Int) : SimpleCommonAdapter<PartyReportBean>(layoutResId) {
    override fun convert(helper: ExtendViewHolder, item: PartyReportBean, position: Int) {

        //头像
        LKImage.load().scale(ScaleMode.CENTER_CROP).placeHolder(R.mipmap.icon_party_head_def)
                .error(R.mipmap.icon_party_head_def).load(item.faceUrl)
                .into(helper.getView<LKCircleImageView>(R.id.liv_irpD_partyHead))

        //时间
        val tiemView = helper.getView<TextView>(R.id.liv_irpD_addTime)
        tiemView?.text = OperationServer.formatStr(item.createTime)

        //党员名称
        val partyName = helper.getView<TextView>(R.id.liv_irpD_partyName)
        partyName?.text = item.name

        //网格名称
        val wangGeName = helper.getView<TextView>(R.id.liv_irpD_location)
        wangGeName?.text = item.grid
    }
}